/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ca.trader.utils;

import ca.trader.regions.Country;
import ca.trader.regions.RegionManager;
import ca.trader.sale.SaleCategoryEnum;
import ca.trader.startup.ServletContextManager;
import javax.servlet.http.HttpSession;

/**
 * Utility functions to be used by JSP pages
 * @author Ahsan
 */
public class UIUtils
{

	 /**
	  * Checks if a user has been successfully authenticated against a given HttpSession
	  * @param session the session object
	  * @return whether a user has been successfully authenticated against the session
	  */
	 public static boolean wasUserAuthenticationSuccess(HttpSession session)
	 {
		  return HttpUtils.wasUserAuthenticationSuccess(session);
	 }


	 /**
	  * Gets the list of all countries
	  * @return the list of countries as an array
	  */
	 public static Country[] getCountryList()
	 {
		  RegionManager regionManager = ServletContextManager.getRegionManager();

		  return regionManager.getCountryList();
	 }

	 /**
	  * Gets the list of all sale categories
	  * @return sale categories
	  */
	 public static SaleCategoryEnum[] getCategoryList()
	 {
		  return SaleCategoryEnum.values();
	 }

}
